#include "Component.h"

namespace TG
{
	Component::Component():enable(true)
	{
	}

	Component::~Component()
	{
	}

	void Component::onCreate()
	{
		life = LIFT::CREATE;
		isFirstStart = false;
	}

	void Component::onEnable()
	{
		life = LIFT::ENABLE;
	}

	void Component::onStart()
	{
		life = LIFT::START;
		isFirstStart = true;
	}

	void Component::update()
	{
		life = LIFT::UPDATE;
	}

	void Component::onDisable()
	{
		life = LIFT::DISABLE;
	}

	void Component::onDestroy()
	{
		life = LIFT::DESTROY;
	}

	void Component::setEnable(bool b)
	{
		enable = b;
		if (b)
		{
			onEnable();
		}
		else
		{
			onDisable();
		}
	}
}